def solve(s):
    if s.startswith('2020'):
        print('YES')
        return 
    elif s.endswith('2020'):
        print('YES')
        return 
    elif s.startswith('2') and s.endswith('020'):
        print('YES')
        return 
    elif s.startswith('20') and s.endswith('20'):
        print('YES')
        return 
    elif s.startswith('202') and s.endswith('0'):
        print('YES')
        return 
    else:
        print("NO")
        

tc = int(input())
for t in range(tc):
    input()
    s = input()
    solve(s)
